/**
 * 
 */
package com.wubo.bm.common.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.wubo.bm.common.acl.FeedBackAcl;
import com.wubo.sec.acl.core.AclModel;
import com.wubo.sec.acl.core.GlobalAcl;
import com.wubo.sec.model.User;

/**
 * 留言或反馈
 * @author WuBo
 * @CreateDate 2012-2-22 上午11:23:59
 */
@Entity
@Table(name="FeedBack")
public class FeedBack implements AclModel {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	private String title; //标题
	private String content; //内容
	private Date emitDate; //发表日期
	private int agree; //赞成
	private int disagree; //反对
	@ManyToOne(targetEntity=FeedBack.class, fetch=FetchType.EAGER)
	@JoinColumn(name="parentId")
	private FeedBack parent; //引用
	private boolean audited; //是否已审核
	@ManyToOne(targetEntity=User.class, fetch=FetchType.EAGER)
	@JoinColumn(name="username")
	private User user; //用户名
	private String ip; //发表人IP
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Date getEmitDate() {
		return emitDate;
	}
	public void setEmitDate(Date emitDate) {
		this.emitDate = emitDate;
	}
	public int getAgree() {
		return agree;
	}
	public void setAgree(int agree) {
		this.agree = agree;
	}
	public int getDisagree() {
		return disagree;
	}
	public void setDisagree(int disagree) {
		this.disagree = disagree;
	}
	public FeedBack getParent() {
		return parent;
	}
	public void setParent(FeedBack parent) {
		this.parent = parent;
	}
	public boolean isAudited() {
		return audited;
	}
	public void setAudited(boolean audited) {
		this.audited = audited;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	
	@Override
	public GlobalAcl getAcl() {
		return new FeedBackAcl(this);
	}
}
